//
//  MsgModel.swift
//  MetaTest
//
//  Created by yhb on 2024/10/26.
//
import ObjectMapper

class MsgModel: Mappable {

    var object: String?
    var usage: Usage?
    var model: String?
    var choices: [MsgDataModel]?
    var id: String?
    var created: Int?

    required init?(map: Map) {}

    func mapping(map: Map) {
        object <- map["object"]
        usage <- map["usage"]
        model <- map["model"]
        choices <- map["choices"]
        id <- map["id"]
        created <- map["created"]
    }
}

class Usage: Mappable {

    var completionTokens: Int?
    var totalTokens: Int?
    var promptTokens: Int?

    required init?(map: Map) {}

    func mapping(map: Map) {
        completionTokens <- map["completion_tokens"]
        totalTokens <- map["total_tokens"]
        promptTokens <- map["prompt_tokens"]
    }
}

class MsgDataModel: Mappable {

    var index: Int?
    var message: Message?
    var logprobs: Any?
    var finishReason: String?

    required init?(map: Map) {}

    func mapping(map: Map) {
        index <- map["index"]
        message <- map["message"]
        logprobs <- map["logprobs"]
        finishReason <- map["finish_reason"]
    }
}

class Message: Mappable {

    var role: String?
    var content: String?

    required init?(map: Map) {}

    func mapping(map: Map) {
        role <- map["role"]
        content <- map["content"]
    }
}

